Gradual Typing with Efficient Object Casts
نویسندگان
چکیده
Gradual type systems meld dynamic typing with optional static types, moderating between the two with statically inserted casts. Casting is the éminence grise of such systems — it enables swift detection of type errors in dynamic code without enforcing runtime checks throughout a program, and in combination with blame tracking it allows such errors to be traced to their origin. However, such casts accumulate as data is passed between static and dynamic portions of a program, and the naı̈ve solution of fully applying casts whenever data flows through them — and therefore creating new, casted values — is highly inefficient in both space and time. Worse, this naı̈ve solution makes a copy of the object, which is incompatible with the semantics of imperative object-oriented languages. This problem must be solved if gradual typing is to become practical for common dynamic languages.
منابع مشابه
Efficient Gradual Typing
Gradual typing combines static and dynamic typing in the same program. One would hope that the performance in a gradually typed language would range between that of a dynamically typed language and a statically typed language. Existing implementations of gradually typed languages have not achieved this goal due to overheads associated with runtime casts. Takikawa et al. (2016) report up to 100×...
متن کاملSpace-Efficient Blame Tracking for Gradual Types
Static and dynamic type systems have well-known strengths and weaknesses. Gradual typing provides the benefits of both in a single language by giving the programmer control over which portions of the program are statically typed and which portions are dynamically checked based on the presence or absence of type annotations. A compiler for a gradually typed language infers where the dynamic chec...
متن کاملGradual Typing for Objects
Static and dynamic type systems have well-known strengths and weaknesses. In previous work we developed a gradual type system for a functional calculus named λ→. Gradual typing provides the benefits of both static and dynamic checking in a single language by allowing the programmer to control whether a portion of the program is type checked at compile-time or run-time by adding or removing type...
متن کاملGradual Typing in an Open World
Gradual typing combines static and dynamic typing in the same language, offering the benefits of both to programmers. Static typing provides error detection and strong guarantees while dynamic typing enables rapid prototyping and flexible programming idioms. For programmers to take full advantage of a gradual type system, however, they must be able to trust their type annotations, and so runtim...
متن کاملExploring the Design Space of Higher-Order Casts ; CU-CS-1047-08
This paper explores the surprisingly rich design space for the simply typed lambda calculus with casts and a dynamic type. Such a calculus is the target intermediate language of the gradually typed lambda calculus but it is also interesting in its own right. In light of diverse requirements for casts, we develop a modular semantic framework, based on Henglein’s Coercion Calculus, that instantia...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2012